package com.romotc.qqrobot.webqq.qqInterfaceCatching;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.json.JSONException;

import com.romotc.qqrobot.webqq.WebQQConstant;
import com.romotc.scache.RequestSpy;
import com.romotc.scache.WebConnection;

/**
 * http://check.ptlogin2.qq.com/check?uin=1586030808&appid=1003903&r=0.005160598549991846
 * @author Administrator
 *	是否需要验证码catching
 */
public class Ptlogin2Check_Catching extends QQUrlBodyCatching {

	@Override
	public boolean modifyResponse(WebConnection wc, RequestSpy rqSpy)
			throws IOException {
		return false;
		
	}

	/**
	 * 请求参数uin
	 */
	private static final String Key_Req_Param_Uin = "uin";

	@Override
	String getHackReqBodyStr(RequestSpy requestSpy,Map<String, Object> var) {
		try {
			String loginUin = requestSpy.getReqInfoParamJson().getString(Key_Req_Param_Uin);
			
			if(WebQQConstant.isRobotUin(loginUin)) {
				return "ptui_checkVC('0','!KKK');";
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}

	@Override
	boolean isGoOn(RequestSpy requestSpy) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	ArrayList<String> hackRequestHeader(RequestSpy requestSpy, int bodySize,Map<String, Object> var) {
		// TODO Auto-generated method stub
		return null;
	}
}
